/**
 * 取消禁用
 * @param id
 * @param callback
 * @param loading
 */
function doNormal(id, callback, loading) {
    var data = {
        "id": id
    };
    var url = $.domain + "/Console/User/doNormal";
    sApi(url, data, callback, loading);
}
/**
 * 禁用用户
 * @param id
 * @param callback
 * @param loading
 */
function doForbidden(id, callback, loading) {
    var data = {
        "id": id
    };
    var url = $.domain + "/Console/User/doForbidden";
    sApi(url, data, callback, loading);
}

/**
 * 获取设为推手的表单
 * @param {*} id 
 */
function doGetWorkerForm(id, callback, loading) {
    var data = {
        "id": id
    };
    var url = $.domain + "/Console/User/doGetWorkerForm";
    sApi(url, data, callback, loading);
}

/**
 * 设置推手
 * @param {*} id 
 * @param {*} data 
 * @param {*} callback 
 * @param {*} loading 
 */
function doSetWorker(id, data, callback, loading) {
    data.id = id;
    var url = $.domain + "/Console/User/doSetWorker";
    sApi(url, data, callback, loading);
}

/**
 * 禁用推手
 * @param {*} id 
 * @param {*} callback 
 * @param {*} loading 
 */
function doForbiddenWorker(id, callback, loading) {
    var data = {
        "id": id
    };
    var url = $.domain + "/Console/User/doForbiddenWorker";
    sApi(url, data, callback, loading);
}

/**
 * 获取列表
 * @param phone
 * @param password
 * @param callback
 * @param loading
 */
function doGetList(data, callback, loading) {
    var url = $.domain + "/Console/User/doGetList";
    sApi(url, data, callback, loading);
}


/**
 * api调用
 * @param url
 * @param data
 * @param callback
 * @param loading
 */
function sApi(url, data, callback, loading) {
    if (typeof callback !== "function") {
        callback = emptyFunc;
    }

    if (typeof loading == "undefined") {
        loading = true;
    }

    var param = {
        "url": url,
        "data": data,
        "success": function (res) {
            if (!res) {
                res = errRes("网络响应超时");
            }
            callback(res);
        },
        "error": function () {
            callback(errRes("网络响应超时"));
        },
        "loading": loading ? true : false
    };
    $.sAjax(param);
}